package com.dotndot.controller.network;

import java.util.List;

import org.apache.http.entity.mime.MultipartEntity;
import org.apache.http.message.BasicNameValuePair;

public class Server
{

    // public static final String MAIN_SERVER_ADDRESS =
    // "http://localhost:8888/";
    // public static final String MAIN_SERVER_URL =
    // "http://skyyy80.appspot.com";
    public static final String MAIN_SERVER_URL = "http://localhost:8888/";

    public static final int REQUEST_POST_BASIC_TYPE = 0;
    public static final int REQUEST_POST_MULTIPART_TYPE = 1;
    public static final int REQUEST_GET_TYPE = 2;

    public static final int RESPONSE_SUCCESS = 0;
    public static final int RESPONSE_ERROR = 1000;
    public static final int RESPONSE_TIME_OUT_ERROR = RESPONSE_ERROR + 1;

    public static final int LOGIN_API = 0;
    public static final int JOIN_API = 1;
    public static final int STORY_ADD_API = 2;
    public static final int STORY_LIST_API = 3;

    public static final String LOGIN_URL = "/user/login.dnd";
    public static final String ID = "id";
    public static final String PASSWORD = "password";
    public static final String APIKEY = "apikey";

    public static final String JOIN_URL = "/user/join.dnd";
    public static final String JOIN_PW = "password";
    public static final String JOIN_EMAIL = "email";

    public static final String STORY_ADD_URL = "/story/add.dnd";
    public static final String STORY_LIST_URL = "/story/list.dnd";
    public static final String STORY_DESCRIPTION = "description";
    public static final String STORY_IMAGE = "image";

    // public static final String STORY_ADD_ADDR
    public static final int SERVER_SOCKET_TIMEOUT = 30 * 1000;
    public static final int SERVER_READ_TIMEOUT = 30 * 1000;

    public static final int TEST_API = 999;

    /* Server URI �Ѱ��ִ� �Լ� */
    // public static String getServerUri( int requestApi )
    // {
    // String uri = null;
    // switch( requestApi )
    // {
    // case LOGIN_API:
    // uri = makeServerUri(LOGIN_URL);
    // break;
    //
    // case JOIN_API:
    // uri = makeServerUri(JOIN_URL);
    // break;
    //
    // case STORY_ADD_API:
    // uri = makeServerUri(STORY_ADD_URL);
    // break;
    //
    // case STORY_LIST_API:
    // uri = makeServerUri(STORY_LIST_URL);
    // break;
    // }
    // return uri;
    // }
    //
    // private static String makeServerUri( String url )
    // {
    // return MAIN_SERVER_URL + url;
    // }

    // public static void setServerParam( int requestApi, ServerParam param,
    // List<BasicNameValuePair> mBasicParam )
    // {
    // switch( requestApi )
    // {
    // case LOGIN_API:
    // mBasicParam.add(new BasicNameValuePair(ID, param.get(ID)));
    // mBasicParam.add(new BasicNameValuePair(PASSWORD, param.get(PASSWORD)));
    // break;
    //
    // case JOIN_API:
    // mBasicParam.add(new BasicNameValuePair(ID, param.get(ID)));
    // mBasicParam.add(new BasicNameValuePair(PASSWORD, param.get(PASSWORD)));
    // mBasicParam.add(new BasicNameValuePair(JOIN_EMAIL,
    // param.get(JOIN_EMAIL)));
    // break;
    //
    // case STORY_LIST_API:
    // mBasicParam.add(new BasicNameValuePair(APIKEY, param.get(APIKEY)));
    // break;
    // }
    // }
    //
    // public static void setServerParam( int requestApi, ServerParam param,
    // MultipartEntity mMultipartParam )
    // {
    // try
    // {
    // switch( requestApi )
    // {
    // case STORY_ADD_API:
    // mMultipartParam.addPart(ID, new StringBody(param.get(ID)));
    // mMultipartParam.addPart(PASSWORD, new StringBody(param.get(PASSWORD)));
    //
    // if( param.get(STORY_DESCRIPTION) != null )
    // {
    // mMultipartParam.addPart(STORY_DESCRIPTION, new
    // StringBody(param.get(STORY_DESCRIPTION)));
    // }
    //
    // if( param.get(STORY_IMAGE) != null )
    // {
    // mMultipartParam.addPart(STORY_IMAGE, new FileBody(new
    // File(param.get(STORY_IMAGE))));
    // }
    // break;
    // }
    // }
    // catch( UnsupportedEncodingException e )
    // {
    // e.printStackTrace();
    // }
    // }

}
